#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    bool evaluateTree(TreeNode* root) {

        if (root->left == nullptr && root->right == nullptr)
            return root->val;
        return root->val == 3 ? evaluateTree(root->left) && evaluateTree(root->right)
            : evaluateTree(root->left) || evaluateTree(root->right);

    }
};